from app import db, loginmanager
from datetime import datetime


class JascoOrder(db.Model):
    __tablename__ = 'jasco_order'
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), comment='用户ID')
    code = db.Column(db.String(100), unique=True, index=True, comment='订单号')
    status = db.Column(db.String(30), comment='订单状态')
    type = db.Column(db.String(30), comment='订单类型')
    logistics_code = db.Column(db.String(64), comment='物流单号')
    logistics_channel = db.Column(db.String(20), comment='运输渠道')
    destination = db.Column(db.String(100), comment='目的国/州/省/市')
    receiving_time = db.Column(db.DateTime, comment='收货时间')
    consignee = db.Column(db.String(36), comment='收货人')
    consignee_company = db.Column(db.String(100), comment='收货人公司')
    consignee_phone = db.Column(db.String(20), comment='收货人电话')
    consignee_email = db.Column(db.String(50), comment='收货人邮箱')
    postcode = db.Column(db.String(30), comment='邮编')
    # keyword = db.Column(db.String(100), comment='关键词')
    has_insure = db.Column(db.String(1), comment='有无保险 有1 无0')
    clearance_type = db.Column(db.String(100), comment='报关方式')
    trade_clause = db.Column(db.String(100), comment='贸易条款')
    tfn_vat = db.Column(db.String(50), comment='税号-VAT')
    tfn_eori = db.Column(db.String(50), comment='税号-EORI')
    tfn_ein = db.Column(db.String(50), comment='税号-EIN')
    tfn_other = db.Column(db.String(50), comment='税号-其他')
    packages_num = db.Column(db.Integer, comment='件数')
    address1 = db.Column(db.String(100), comment='详细地址1')
    address2 = db.Column(db.String(100), comment='详细地址2')
    address3 = db.Column(db.String(100), comment='详细地址3')
    packages_weight = db.Column(db.String(20), comment='总实重')
    packages_volume = db.Column(db.String(20), comment='总体积')
    billing_weight_squaremeter = db.Column(db.String(20), comment='计费重/方')
    volume_divisor = db.Column(db.String(20), comment='材积除数')
    create_time = db.Column(db.DateTime, default=datetime.now)
    update_time = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now)



